﻿using FDStudio.Core.Entities;
using FDStudio.Core.Entities.Enums;
using FDStudio.Core.Entities.Query;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq.Expressions;

namespace FDStudio.Core.Repositories
{
    /*
     CreatedOn: 2018-01-25
     CreatedBy: Jackie Lee(天宇遊龍)
     */
    /// <summary>
    /// 仓储上下文
    /// </summary>
    public interface IDefaultRepositoryContext : IReadOnlyRepositoryContext, IWriteOnlyRepositoryContext
    {
        ///// <summary>
        ///// 数据库类型
        ///// </summary>
        //DatabaseType DatabaseType { get; }

        ///// <summary>
        ///// 当插入数据时，获取新插入值自增列
        ///// </summary>
        //string AddedIDString { get; }

        //void Switch(DatabaseType databaseType, string name);

        //bool Add<T>(T model) where T : class, IEntity;

        //bool Update<T>(T model) where T : class, IEntity;

        //T Get<T>(long id) where T : class, IEntity;

        //T Get<T>(Expression<Func<T, bool>> condition) where T : class, IEntity;

        ///// <summary>
        ///// 获取条数
        ///// </summary>
        ///// <param name="condition">条件</param>
        ///// <returns></returns>
        //int Count<T>(Expression<Func<T, bool>> condition) where T : class, IEntity;

        //IEnumerable<T> GetList<T>(Expression<Func<T, bool>> condition, IQueryOrder<T> orderBy = null) where T : class, IEntity;

        ///// <summary>
        ///// 如需调用PageList返回结果，此项需要处理
        ///// 参数依次为：原查询语句，查询页索引（1开始），查询页大小，返回分页的语句
        ///// </summary>
        //Func<string, long, long, string> PagingAction { get; }

        ///// <summary>
        ///// 进行分页操作
        ///// </summary>
        ///// <typeparam name="T"></typeparam>
        ///// <param name="condition"></param>
        ///// <param name="pagingAction">传入查询字符串，根据所需处理并返回结果查询字符串</param>
        ///// <param name="orderBy"></param>
        ///// <returns></returns>
        //PagedList<T> GetList<T>(Expression<Func<T, bool>> condition, long pageIndex, long pageSize, IQueryOrder<T> orderBy = null) where T : class, IEntity;

        //bool Delete<T>(T model) where T : class, IEntity;

        //bool Delete<T>(Expression<Func<T, bool>> condition) where T : class, IEntity;

        //int ExecuteNonQuery(string sql, object parameter = null, CommandType commandType = CommandType.Text);

        //void ExecuteDataReader(string sql, Action<IDataReader> read, object parameter = null, CommandType commandType = CommandType.Text);

        //T ExecuteScalar<T>(string sql, object parameter = null, CommandType commandType = CommandType.Text);

        //void BeginTransaction();

        //void CommitTransaction();

        //void RollbackTransaction();
    }
}
